Objects Reference

class light_map

Definition

class light_map
{
public:
    vector v0, v1, v2;
    vector d0, d1, d2, normal;
    float det;
    float uv[3][2];
    int lastupdate;
    int pic;
    int offsetx,offsety;
    int sizex,sizey;
    int facenum;
    unsigned char *bmp;
    int bytespixel,bytesx,bytesxy;

    light_map(int f,int p,int x,int y,int sx,int sy,int bp=3)
    {
        facenum=f;
        pic=p;
        offsetx=x;
        offsety=y;
        sizex=sx;
        sizey=sy;
        bytespixel=bp;
        lastupdate=0;
        bytesx=sx*bp;
        if (bytesx&3)
            bytesx+=4-(bytesx&3);
        bytesxy=bytesx*sy;
        bmp=new unsigned char[bytesxy];
    };
    void map_point(float u, float v, vector &point);
    void set_base(face *f,light_map_pic *lmp,vector& pos=vector(0,0,0));
    void illum(vector& pos,vector& color,float rad,int shadows);
    void load(light_map_pic *lmp);
    void save(light_map_pic *lmp);

    virtual ~light_map()
    {
        if (bmp)
            delete bmp;
    };
};

Data Members

Member Type Description
d0 vector light_map origin (0,0) in world space
d1 vector light_map u vector (1,0) in world space
d2 vector light_map v vector (0,1) in world space
lastupdate int last frame this light_map has changed
pic int light_map_pic index
offsetx int x offset into light_map_pic
offsety int y offset into light_map_pic
sizex int x size of light_map (power of 2 or not)
sizey int y size of light_map (power of 2 or not)
facenum int face index for one face using this light_map
bmp unsigned char * light_map bitmap
bytespixel int the light map bytes per pixel:
3 - RGB
4 - RGBA
bytesx int number of bytes per line (sizex*bytespixel aligned to 4 bytes)
bytesxy int total bytes of the light_map bmp (bytesx*sizey)

Methods

constructor, map_point, set_base, illum, load, save

Remarks

This class implements a light map. Several faces (co-planar) can share the same light_map and many light_maps can share the same light_map_pic. Each light_map has an offset and size inside its light_map_pic.

See Also

light_map_pic, vector, face, flyEngine